﻿#region Using
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#endregion

#region Namespace
namespace Eloje_Data
{
    #region Classe
    public class DbMain
   {
       #region Construtores
       public DbMain()
       {
           this.connString = "Server = JOSÉ-VAIO; Database = eLoje; Trusted_Connection = yes;";/*/@"Data Source = STFPINC017070-W\SQLEXPRESS;
                           Integrated Security = false; Database = eLoje; user = sa; password= stefanini@10"; /*"STFPINC017070-W\SQLEXPRESS;"*/
       }
       #endregion

       #region Propriedades
       protected SqlConnection conn = null;
       protected string connString { get; private set; }
       #endregion
       #region Metodos
       public void conectar()
       {
           bool erro = false;
           try
           {
               conn = new SqlConnection(connString);

               if (conn.State == System.Data.ConnectionState.Closed)
                   conn.Open();

               erro = false;
           }
           catch (SqlException ex)
           {
               //Logs.TrataErros(ex);

               //MessageBox.Show(ex.Message, "Banco de Dados");
           }
           finally
           {
               if (erro == true)
               {
                   conn.Close();
               }
           }
       }
       #endregion


   }
    #endregion
}
#endregion
